#include "ListNode.h"

//typedef struct ListNode
//{
//	LTDataType val;
//	struct ListNode* next;
//	struct ListNode* prev;
//}ListNode;

void test1()
{
	ListNode* head = NULL;
	head=init();
	pushback(head, 1); 
	pushback(head, 2);
	pushback(head, 3);
	pushback(head, 4);
	print(head);
	popback(head);
	print(head);
	popback(head);
	popback(head);
	popback(head);
	print(head);
	//popback(head);
}

void test2()
{
	ListNode* head = NULL;
	head = init();
	pushfront(head, 0);
	pushback(head, 1);
	pushback(head, 2);
	pushback(head, 3);
	pushfront(head, 30);
	pushfront(head, 40);
	print(head);
	popfront(head);
	print(head);
	//popfront(head);
	//popfront(head);
	//popfront(head);
	//popfront(head);
	//popfront(head);
	//print(head);
	//popfront(head);
	ListNode* fin1=find(head, 100);
	if (fin1 != NULL)
	{
		printf("%d\n", fin1->val);
	}

	ListNode* fin2 = find(head, 2);
	insertpos(fin2, 100);
	print(head);
	erasepos(fin2);
	print(head);

}

void test3()
{
	ListNode* head = NULL;
	head = init();
	pushfront(head, 0);
	pushback(head, 1);
	pushback(head, 2);
	pushback(head, 3);
	pushfront(head, 30);
	print(head);
	//eraselist(head);
	destory(head);
}

void test4()
{
	ListNode* head = NULL;
	head = init();
	insertpos(head, 1);
	ListNode* tail = head->prev;
	insertpos(tail, 2);
	insertpos(head->next, -1);
	print(head);

}

int main()
{
	//test1();
	//test2();
	//test3();
	test4();
	return 0;
}